package JSE_02.Collection.Demo01;

import java.util.ArrayList;
import java.util.Collection;

public class Demo01Collection {
    public static void main(String[] args){
        Collection<String> coll=new ArrayList<>();
        System.out.println(coll);
        boolean b1=coll.add("张三");
        System.out.println("b1:"+b1);
        System.out.println(coll);

        coll.add("李四");
        coll.add("王五");
        coll.add("赵六");
        coll.add("田七");
        System.out.println(coll);


        boolean b2=coll.remove("王五");
        System.out.println("b2:"+b2);
        System.out.println(coll);
        boolean b3=coll.contains("赵六");
        System.out.println(coll);

        boolean b4=coll.isEmpty();
        System.out.println("b4:"+b4);

        int size=coll.size();
        System.out.println("size:"+size);

        // 集合转数组
        Object[] arr=coll.toArray();

        for(int i=0;i<arr.length;i++){
            System.out.println(arr[i]);
        }

        System.out.println(coll);
        System.out.println("==============");
        coll.clear();
        System.out.println(coll);
    }
}
